package com.fgs.common.widget;

import android.content.Context;
import android.os.Bundle;
import android.view.View;
import android.view.animation.AnimationUtils;
import android.view.animation.LinearInterpolator;
import android.view.animation.RotateAnimation;
import android.widget.ImageView;
import android.widget.TextView;

import com.fgs.common.CommonDialog;
import com.fgs.common.R;


/**
*@author fgs
*@date 2020/3/27
**/
public class CustomProgressDialog extends CommonDialog {
//    private ImageView mImageView;
    private TextView mTextView;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
    }

    public CustomProgressDialog(Context context) {
        super(context, R.style.CustomProgressDialog);
        setContentView(R.layout.progressdialog_style);
        setCanceledOnTouchOutside(false);
        setCancelable(true);
//        this.mImageView = findViewById(R.id.image_loading_view);
        this.mTextView = findViewById(R.id.text_loading_msg);
    }

    public CustomProgressDialog setMessage(String strMessage) {
        if (this.mTextView != null) {
            this.mTextView.setText(strMessage);
            this.mTextView.setVisibility(View.VISIBLE);
        }

        return this;
    }

//    public void onWindowFocusChanged(boolean hasFocus) {
//        RotateAnimation rotateAnimation = (RotateAnimation) AnimationUtils.loadAnimation(this.getContext(), R.anim.rotate_animation);
//        LinearInterpolator interpolator = new LinearInterpolator();
//        rotateAnimation.setInterpolator(interpolator);
//        this.mImageView.setAnimation(rotateAnimation);
//    }
}
